﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nHydrate.Generator.Models;
using nHydrate.Generator.Common;

namespace nHydrate.Generator.SQLInstaller
{
	internal static class Extensions
	{
		public static int GetGeneratedVersion(this ModelRoot model)
		{
			int retval = 0;
			ModelCacheFile cacheFile = new ModelCacheFile(model.GeneratorProject);
			retval = cacheFile.GeneratedVersion;
			return retval;
		}

		public static bool IncrementGeneratedVersion(this ModelRoot model)
		{
			ModelCacheFile cacheFile = new ModelCacheFile(model.GeneratorProject);
			int version = cacheFile.GeneratedVersion;

			//Increment the version
			cacheFile.GeneratedVersion++;
			cacheFile.Save();
			return true;
		}

	}
}
